var e = require;
var t = module;
var n = exports;
var o,
    i =
        (this && this.__extends) ||
        ((o = function (e, t) {
            return (o =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
                })(e, t);
        }),
        function (e, t) {
            function n() {
                this.constructor = e;
            }
            o(e, t), (e.prototype = null === t ? Object.create(t) : ((n.prototype = t.prototype), new n()));
        }),
    r =
        (this && this.__decorate) ||
        function (e, t, n, o) {
            var i,
                r = arguments.length,
                a = r < 3 ? t : null === o ? (o = Object.getOwnPropertyDescriptor(t, n)) : o;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, n, o);
            else
                for (var s = e.length - 1; 0 <= s; s--)
                    (i = e[s]) && (a = (r < 3 ? i(a) : 3 < r ? i(t, n, a) : i(t, n)) || a);
            return 3 < r && a && Object.defineProperty(t, n, a), a;
        };
Object.defineProperty(n, "__esModule", {value: !0});
var a,
    s = e("Exceltheme"),
    c = e("player-theme"),
    t = cc._decorator,
    e = t.ccclass,
    t = t.property,
    e =
        ((a = cc.Component),
        i(l, a),
        (l.prototype.start = function () {}),
        (l.prototype.init = function (e, t) {
            if (
                ((this.curIdx = e),
                (this.bg.active = 0 <= e),
                (this.node.getComponent(cc.Button).interactable = 0 <= e),
                (this.unknown.active = e < 0),
                e < 0)
            )
                return !1;
            (this.iconLabel.active = 1 === this.curIdx),
                (this.icon.spriteFrame = this.iconSpriteFrames[this.curIdx - 1]),
                (this.selectFunction = t);
            t = s.default.GetLine(this.curIdx);
            (this.needGold = t.needGold), (this.label.string = t.label);
            t = c.playerTheme.getCurTheme();
            (this.isSelect = t + 1 === e),
                (this.useNode.active = this.isSelect),
                (this.selectNode.active = this.isSelect),
                (this.isLock = c.playerTheme.getThemeLock(this.curIdx - 1));
            e = this.isLock ? this.grayMaterial : this.normalMaterial;
            return this.icon.setMaterial(0, e), this.isSelect;
        }),
        (l.prototype.getNeedGold = function () {
            return this.needGold;
        }),
        (l.prototype.getIsLock = function () {
            return this.isLock;
        }),
        (l.prototype.unlock = function () {
            c.playerTheme.setThemeLock(this.curIdx - 1, !1), (this.isLock = !1);
            var e = this.isLock ? this.grayMaterial : this.normalMaterial;
            this.icon.setMaterial(0, e);
        }),
        (l.prototype.setSelect = function (e) {
            (this.isSelect = e), (this.selectNode.active = this.isSelect);
        }),
        (l.prototype.select = function () {
            this.selectFunction && this.selectFunction(this.curIdx);
        }),
        (l.prototype.setUse = function (e) {
            (this.useNode.active = e) && c.playerTheme.setCurTheme(this.curIdx - 1);
        }),
        (l.prototype.getIsUse = function () {
            return this.useNode.active;
        }),
        (l.prototype.getId = function () {
            return this.curIdx;
        }),
        r([t(cc.Label)], l.prototype, "label", void 0),
        r([t(cc.Node)], l.prototype, "selectNode", void 0),
        r([t(cc.Node)], l.prototype, "useNode", void 0),
        r([t(cc.Sprite)], l.prototype, "icon", void 0),
        r([t(cc.Node)], l.prototype, "iconLabel", void 0),
        r([t(cc.Node)], l.prototype, "unknown", void 0),
        r([t(cc.Node)], l.prototype, "bg", void 0),
        r([t([cc.SpriteFrame])], l.prototype, "iconSpriteFrames", void 0),
        r([t(cc.Material)], l.prototype, "normalMaterial", void 0),
        r([t(cc.Material)], l.prototype, "grayMaterial", void 0),
        r([e], l));
function l() {
    var e = (null !== a && a.apply(this, arguments)) || this;
    return (
        (e.label = null),
        (e.selectNode = null),
        (e.useNode = null),
        (e.icon = null),
        (e.iconLabel = null),
        (e.unknown = null),
        (e.bg = null),
        (e.iconSpriteFrames = []),
        (e.normalMaterial = null),
        (e.grayMaterial = null),
        (e.curIdx = 0),
        (e.selectFunction = null),
        (e.isSelect = !1),
        (e.isLock = !1),
        (e.needGold = 0),
        e
    );
}
n.default = e;
